﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SMSMTROUTER.Business;

namespace SMSMTROUTER
{
    public partial class FrmEditRouter : FrmEditBase
    {
        private SmsRouter router;
        public FrmEditRouter(SmsRouter router)
        {
            InitializeComponent();
            this.router = router;
            this.Load += new EventHandler(FrmEditRouter_Load);
        }

        void FrmEditRouter_Load(object sender, EventArgs e)
        {
            txtRouterName.DataBindings.Add("Text", router, "RouterName");
            txtRouterDescription.DataBindings.Add("Text", router, "RouterDescription");
            txtTypeOfObject.DataBindings.Add("Text", router, "TypeOfObject");
            txtRouterURL.DataBindings.Add("Text", router, "RouterURL");
            txtRouterURL2.DataBindings.Add("Text", router, "RouterURL2");
            txtUserName.DataBindings.Add("Text", router, "UserName");
            txtPassword.DataBindings.Add("Text", router, "Password");
            txtRouterType.DataBindings.Add("Text", router, "RouterType");
            txtPublicKey.DataBindings.Add("Text", router, "PublicKey");
            txtPublicPrivateKey.DataBindings.Add("Text", router, "PublicPrivateKey");
            txtEnabled.DataBindings.Add("Text", router, "Enabled");
            txtNumOfThread.DataBindings.Add("Text", router, "NumOfThread");
        }
        
        protected override void Save()
        {
            router.Save();
        }
    }
}
